/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.pangalacteos.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Leandro Del Sole
 */
@Entity
@Table(name = "fatura")
@NamedQueries({@NamedQuery(name = "Fatura.findByCdfatura", query = "SELECT f FROM Fatura f WHERE f.cdfatura = :cdfatura"), @NamedQuery(name = "Fatura.findByDtfatura", query = "SELECT f FROM Fatura f WHERE f.dtfatura = :dtfatura"), @NamedQuery(name = "Fatura.findByDtvencimento", query = "SELECT f FROM Fatura f WHERE f.dtvencimento = :dtvencimento"), @NamedQuery(name = "Fatura.findByVldesconto", query = "SELECT f FROM Fatura f WHERE f.vldesconto = :vldesconto"), @NamedQuery(name = "Fatura.findByDtfimdesconto", query = "SELECT f FROM Fatura f WHERE f.dtfimdesconto = :dtfimdesconto"), @NamedQuery(name = "Fatura.findByVlmontante", query = "SELECT f FROM Fatura f WHERE f.vlmontante = :vlmontante"), @NamedQuery(name = "Fatura.findByCdreferencia", query = "SELECT f FROM Fatura f WHERE f.cdreferencia = :cdreferencia"), @NamedQuery(name = "Fatura.findByDsfatura", query = "SELECT f FROM Fatura f WHERE f.dsfatura = :dsfatura"), @NamedQuery(name = "Fatura.findByCdduplicata", query = "SELECT f FROM Fatura f WHERE f.cdduplicata = :cdduplicata"), @NamedQuery(name = "Fatura.findByCdnotafiscal", query = "SELECT f FROM Fatura f WHERE f.cdnotafiscal = :cdnotafiscal"), @NamedQuery(name = "Fatura.findByCdserienotafiscal", query = "SELECT f FROM Fatura f WHERE f.cdserienotafiscal = :cdserienotafiscal"), @NamedQuery(name = "Fatura.findByDtpagamento", query = "SELECT f FROM Fatura f WHERE f.dtpagamento = :dtpagamento"), @NamedQuery(name = "Fatura.findByCdstatus", query = "SELECT f FROM Fatura f WHERE f.cdstatus = :cdstatus")})
public class Fatura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Column(name = "cdfatura", columnDefinition="Integer", nullable = false)
    private Integer cdfatura;
    @JoinColumn(name = "cdfornecedor", columnDefinition="Fornecedor", referencedColumnName = "cdfornecedor")
    @ManyToOne
    private Fornecedor cdfornecedor;
    @Column(name = "dtfatura", columnDefinition="Date", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dtfatura;
    @Column(name = "dtvencimento", columnDefinition="Date", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dtvencimento;
    @Column(name = "vldesconto", columnDefinition="Float")
    private Float vldesconto;
    @Column(name = "dtfimdesconto", columnDefinition="Date")
    @Temporal(TemporalType.DATE)
    private Date dtfimdesconto;
    @Column(name = "vlmontante", columnDefinition="Float", nullable = false)
    private float vlmontante;
    @Column(name = "cdreferencia", columnDefinition="String")
    private String cdreferencia;
    @Column(name = "dsfatura", columnDefinition="String")
    private String dsfatura;
    @Column(name = "cdduplicata", columnDefinition="Integer")
    private Integer cdduplicata;
    @Column(name = "cdnotafiscal", columnDefinition="Integer")
    private Integer cdnotafiscal;
    @Column(name = "cdserienotafiscal", columnDefinition="Integer")
    private Integer cdserienotafiscal;
    @Column(name = "dtpagamento", columnDefinition="Date")
    @Temporal(TemporalType.DATE)
    private Date dtpagamento;
    @Column(name = "cdstatus", columnDefinition="String", nullable = false)
    private String cdstatus;

    public Fatura() {
    }

    public Fatura(Integer cdfatura) {
        this.cdfatura = cdfatura;
    }

    public Fatura(Integer cdfatura, Date dtfatura, Date dtvencimento, float vlmontante, String cdstatus) {
        this.cdfatura = cdfatura;
        this.dtfatura = dtfatura;
        this.dtvencimento = dtvencimento;
        this.vlmontante = vlmontante;
        this.cdstatus = cdstatus;
    }

    public Integer getCdfatura() {
        return cdfatura;
    }

    public void setCdfatura(Integer cdfatura) {
        this.cdfatura = cdfatura;
    }

    public Date getDtfatura() {
        return dtfatura;
    }

    public void setDtfatura(Date dtfatura) {
        this.dtfatura = dtfatura;
    }

    public Date getDtvencimento() {
        return dtvencimento;
    }

    public void setDtvencimento(Date dtvencimento) {
        this.dtvencimento = dtvencimento;
    }

    public Float getVldesconto() {
        return vldesconto;
    }

    public void setVldesconto(Float vldesconto) {
        this.vldesconto = vldesconto;
    }

    public Date getDtfimdesconto() {
        return dtfimdesconto;
    }

    public void setDtfimdesconto(Date dtfimdesconto) {
        this.dtfimdesconto = dtfimdesconto;
    }

    public float getVlmontante() {
        return vlmontante;
    }

    public void setVlmontante(float vlmontante) {
        this.vlmontante = vlmontante;
    }

    public String getCdreferencia() {
        return cdreferencia;
    }

    public void setCdreferencia(String cdreferencia) {
        this.cdreferencia = cdreferencia;
    }

    public String getDsfatura() {
        return dsfatura;
    }

    public void setDsfatura(String dsfatura) {
        this.dsfatura = dsfatura;
    }

    public Integer getCdduplicata() {
        return cdduplicata;
    }

    public void setCdduplicata(Integer cdduplicata) {
        this.cdduplicata = cdduplicata;
    }

    public Integer getCdnotafiscal() {
        return cdnotafiscal;
    }

    public void setCdnotafiscal(Integer cdnotafiscal) {
        this.cdnotafiscal = cdnotafiscal;
    }

    public Integer getCdserienotafiscal() {
        return cdserienotafiscal;
    }

    public void setCdserienotafiscal(Integer cdserienotafiscal) {
        this.cdserienotafiscal = cdserienotafiscal;
    }

    public Date getDtpagamento() {
        return dtpagamento;
    }

    public void setDtpagamento(Date dtpagamento) {
        this.dtpagamento = dtpagamento;
    }

    public String getCdstatus() {
        return cdstatus;
    }

    public void setCdstatus(String cdstatus) {
        this.cdstatus = cdstatus;
    }

    public Fornecedor getCdfornecedor() {
        return cdfornecedor;
    }

    public void setCdfornecedor(Fornecedor cdfornecedor) {
        this.cdfornecedor = cdfornecedor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cdfatura != null ? cdfatura.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fatura)) {
            return false;
        }
        Fatura other = (Fatura) object;
        if ((this.cdfatura == null && other.cdfatura != null) || (this.cdfatura != null && !this.cdfatura.equals(other.cdfatura))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.pangalacteos.modelo.Fatura[cdfatura=" + cdfatura + "]";
    }

}
